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

Query time 0.00078