UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RedQpG2qG9IvAVahFk0SBubzAaWl4zHSqn3hE+lttVc=' 
WHERE 
  key_id = '7fdc1f7dbdc09b432a5e2d86603b39b8a02915a1cc6b0d6ab0a9d8807fe7b658' 
  AND (
    token = 'RedQpG2qG9IvAVahFk0SBubzAaWl4zHSqn3hE+lttVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030