UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QJaUafIfal4Oc5hK+t3qhIumqb+xb6a1XobBD9HevVo=' 
WHERE 
  key_id = '111b6d2b3daf1ad0d3f4e437c85f5cbba1c901c25b59235ec1a3c3cb2cb687b6' 
  AND (
    token = 'QJaUafIfal4Oc5hK+t3qhIumqb+xb6a1XobBD9HevVo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046