UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8soWAutaESKRBQl3ReTgdYkTG1DVfPDIB+457ZOY9ko=' 
WHERE 
  key_id = 'df535389826185acc2c6e3ad17f0f0962ffc13ed5ffaa7a6c2e90b4a7a7c6300' 
  AND (
    token = '8soWAutaESKRBQl3ReTgdYkTG1DVfPDIB+457ZOY9ko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045