UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zfqPx/QCAmxAGM0D822ALMw+6plAWi1xxRM6vS5o0+Q=' 
WHERE 
  key_id = '233bc793e34dda5e0f7f651520a022bb92d9a6718b20358a27cf7316ecd20962' 
  AND (
    token = 'zfqPx/QCAmxAGM0D822ALMw+6plAWi1xxRM6vS5o0+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048