UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V1f6axJC8bUVMnxeoQSR9/d86iEMuUnxHfYrHrVblOY=' 
WHERE 
  key_id = '773cebaa66554396bd8cd50c6afc51578df637c30cf2c519a7348b33a0462f35' 
  AND (
    token = 'V1f6axJC8bUVMnxeoQSR9/d86iEMuUnxHfYrHrVblOY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030