UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yk+sMfZ1eQib+MuVgFSSb2YoEIl4j+AwrOObmhIOszo=' 
WHERE 
  key_id = 'a9f43ad917ca51d516e4d718f8ec946849bca1b271bf4a4e08ceb959ddc7b81c' 
  AND (
    token = 'Yk+sMfZ1eQib+MuVgFSSb2YoEIl4j+AwrOObmhIOszo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044