UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WZl2OQniv+5qeCZ5SeRSt2oTs7CvgEphyo+/fLd+sNM=' 
WHERE 
  key_id = '311e3478c86cda332e5ea3dab62734ceb80b777211afa849e744fe0a1c3e0eb7' 
  AND (
    token = 'WZl2OQniv+5qeCZ5SeRSt2oTs7CvgEphyo+/fLd+sNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021