UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aVvlSMffBdd8MrnycW2sCe3iRABzu6AyKQMqZwxXRxs=' 
WHERE 
  key_id = 'd7b06b70086392784f7577d4536571214bc2aeba3d594eb6e4d39d91abe87354' 
  AND (
    token = 'aVvlSMffBdd8MrnycW2sCe3iRABzu6AyKQMqZwxXRxs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044