UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RWRuDrt8nDEt+R6HxoUIDI3FiJW4ezZ5yArMVf2wPY0=' 
WHERE 
  key_id = 'bd8ad9616ddd9814da8d5740a61539f46231fd0255b3202b505b978eaaa482c0' 
  AND (
    token = 'RWRuDrt8nDEt+R6HxoUIDI3FiJW4ezZ5yArMVf2wPY0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028