UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZX07lH4PJUYp6FlkHOAhOdCfRU8tU5n4yLhjIzI0XLA=' 
WHERE 
  key_id = 'bc77445fe4aa4ad02085c2943b48587ad5e0fb4c26f1e2b8c9772ddae341f769' 
  AND (
    token = 'ZX07lH4PJUYp6FlkHOAhOdCfRU8tU5n4yLhjIzI0XLA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031