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

Query time 0.00020