UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JiavF+tGxj4+B721hlULRHpqBOPXOYR9BzOu2YuYf3k=' 
WHERE 
  key_id = '19729b1f3bbfa2bfb7eff8c97f5ce86a706dc14fc46d893b14198b29e6e03b13' 
  AND (
    token = 'JiavF+tGxj4+B721hlULRHpqBOPXOYR9BzOu2YuYf3k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020