UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iJGohMyaECO/OqyJVTHfAtiPIeLnNklVw28AZ1JH0ZY=' 
WHERE 
  key_id = '40314b230e404d526d402c224d14ba6bd7f2433c53471ac94068bdaf8016e3f3' 
  AND (
    token = 'iJGohMyaECO/OqyJVTHfAtiPIeLnNklVw28AZ1JH0ZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034