UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '74lJjVMXtpan/0Riq5cNG8kiEAYUKxq69UG/eYAtDsU=' 
WHERE 
  key_id = '0163b13f1c6ca4e91592a8284a7fcdf8a09f65f16ada4de19964d556f331d22a' 
  AND (
    token = '74lJjVMXtpan/0Riq5cNG8kiEAYUKxq69UG/eYAtDsU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038