UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YKS4JP3XVsZFwejjeGSUL0MdZIaq058DZCBFavcBMqM=' 
WHERE 
  key_id = '81349a2e56fc7e42eacccd30138e21b57b2749929d23396da98005703b20fc2d' 
  AND (
    token = 'YKS4JP3XVsZFwejjeGSUL0MdZIaq058DZCBFavcBMqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033