UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O1ttzCiWem8b/tvoVTU6Q7bCAu15RtEE9BMD12kJ5GQ=' 
WHERE 
  key_id = '6eaaa2f435aa35c25392b2df65bf9b3ea8eaaaf453d7a00946c517b5b1e1d831' 
  AND (
    token = 'O1ttzCiWem8b/tvoVTU6Q7bCAu15RtEE9BMD12kJ5GQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041