UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B3K1cQORlHAxBJn+3Nl/zcTlqXKmONERtPdcj96vwZY=' 
WHERE 
  key_id = 'dc41900982273993d4df7ef8fa77cae9f62cce9a6052fed21845cf13dc50d3b2' 
  AND (
    token = 'B3K1cQORlHAxBJn+3Nl/zcTlqXKmONERtPdcj96vwZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036