UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yaVk90M7slSDbVG+dlKgcguouka5ffcXgoZQSDIb1Ew=' 
WHERE 
  key_id = '9af1b989f28747c787afb05206b97b127a5d76e7b81731a13ba84d323e371e41' 
  AND (
    token = 'yaVk90M7slSDbVG+dlKgcguouka5ffcXgoZQSDIb1Ew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029