UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pQzJt3vZbyA6JhWoS05/OqCFnhI14ZtTQh10/kpM0tM=' 
WHERE 
  key_id = '10a2b5b1f4c10addccfcdafa9e2f3778888c878e06f497b861ef4cb303b99119' 
  AND (
    token = 'pQzJt3vZbyA6JhWoS05/OqCFnhI14ZtTQh10/kpM0tM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032