UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VqwQI0+wdCmhI5o0GzjHb9LfS9u5NtJuSoxiEj2Rq7w=' 
WHERE 
  key_id = 'd5deafb276dccc426a572720a9f2202371197588b270aaa6efa350eb9ac2a5a3' 
  AND (
    token = 'VqwQI0+wdCmhI5o0GzjHb9LfS9u5NtJuSoxiEj2Rq7w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016