UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ERjjRhxyaHx+wp3TA9WABCWximqiYM7CI9HaNq2mtps=' 
WHERE 
  key_id = '533650aa8775cdae61e32ae2f7cc45cd6048d5bfba09c84cc790d409c2f93960' 
  AND (
    token = 'ERjjRhxyaHx+wp3TA9WABCWximqiYM7CI9HaNq2mtps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025