UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gs2g6n898uDNKQvPxEU6M/tPQsyNRNvUE0grmbtmPTE=' 
WHERE 
  key_id = 'a58fe27e8b5ddf113f6b4063aca06e9b0b184cd382ac084c592834ce917a7494' 
  AND (
    token = 'Gs2g6n898uDNKQvPxEU6M/tPQsyNRNvUE0grmbtmPTE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045