UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'io0+yoYRwVfdaQ6SE9R44jR08kcY14xYhZs3EpitnYA=' 
WHERE 
  key_id = '87667fd407b3b69255b38009f323c816dcd2f00f2a8709c03ff10b4f1adac8cc' 
  AND (
    token = 'io0+yoYRwVfdaQ6SE9R44jR08kcY14xYhZs3EpitnYA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016