UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RIdrXZvWxHWgIWue+2LvmamRj2bs4VJEplpzKZBdUDE=' 
WHERE 
  key_id = 'dfa11bff0b2662752ea7df70602653bcbca28796fff83c524d04ee97ac36246a' 
  AND (
    token = 'RIdrXZvWxHWgIWue+2LvmamRj2bs4VJEplpzKZBdUDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042