UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mqNv2viFen/qsHb85vQL5J612WEns20TbyOl28rrvQQ=' 
WHERE 
  key_id = '2147fe2f2b95267cdd2ecd45fb45238ccb7c87ea9fd2b443a31affacdc55491a' 
  AND (
    token = 'mqNv2viFen/qsHb85vQL5J612WEns20TbyOl28rrvQQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023