UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aHYyL5OLCfOe/zQkYImaUESg9KeEpGNcMa8oU/VCGmM=' 
WHERE 
  key_id = '6919d8d6047724c5b990601ebd640d97f0cac84b543875988b379bdc074fa9d6' 
  AND (
    token = 'aHYyL5OLCfOe/zQkYImaUESg9KeEpGNcMa8oU/VCGmM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034