UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XpfQ7zcq0eYCJwuVOOgnyjgIpih3uTHKwG+ll05rz4g=' 
WHERE 
  key_id = '5ca196f300ddb76e618bf9e3ae7727054385e764928b7ee4a3a9d26a3ba897ff' 
  AND (
    token = 'XpfQ7zcq0eYCJwuVOOgnyjgIpih3uTHKwG+ll05rz4g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028