UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u58GdBZFX7mFYzIWsxdoKuY+OpPM8QZzkDb1NG6l+G8=' 
WHERE 
  key_id = 'f4e0d6cad095b0680e1fd6cc5532dfe229af546321454104707bd9572c136915' 
  AND (
    token = 'u58GdBZFX7mFYzIWsxdoKuY+OpPM8QZzkDb1NG6l+G8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028