UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pLJOyuuwHztG9C2hwldg5rkguK08BooW2HPRTHy+ZBY=' 
WHERE 
  key_id = '4c285e39eef0bce8df5d552266b893ab20e9f57724de372f6487c392456e4e41' 
  AND (
    token = 'pLJOyuuwHztG9C2hwldg5rkguK08BooW2HPRTHy+ZBY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035