UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DPPLA6sC4xxEHLoxDUg46+7VQkAV6m4/gAqja0fJCKI=' 
WHERE 
  key_id = '7696589c2f953eb36a0e3a9c2a66a7ee2447bd5d18746e439a02646a5a2e929d' 
  AND (
    token = 'DPPLA6sC4xxEHLoxDUg46+7VQkAV6m4/gAqja0fJCKI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037