UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JNTS4e7KdzvJioi6N2SbX2NT5lhgBv0ISdY7uEO92J0=' 
WHERE 
  key_id = '50e1c30aa6114d9cb6d5be2b517e36061a2a6862240aa73ff666689650fb717b' 
  AND (
    token = 'JNTS4e7KdzvJioi6N2SbX2NT5lhgBv0ISdY7uEO92J0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024