UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i9hjQX/lkXutc3QV22cadTDCg5/f6HqTWqFpWT63CMY=' 
WHERE 
  key_id = '344c0a4b7a4c3f0e4117660c835660feafa65626df22141e4d454d51c6fac342' 
  AND (
    token = 'i9hjQX/lkXutc3QV22cadTDCg5/f6HqTWqFpWT63CMY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033