UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G4rvHLeB+vL5hSgvrk+tPyX95Gd7vXFtu+hzHioYdD8=' 
WHERE 
  key_id = '50bc676c12a8130c7aa0ffe796e41b7d8e8df1d10065b5e90aae612c2cabfa2f' 
  AND (
    token = 'G4rvHLeB+vL5hSgvrk+tPyX95Gd7vXFtu+hzHioYdD8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021