UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MMHdo0LEPu3YjnKCqmzzjsF/oHsKtkeJQ7YlHu/ZkdU=' 
WHERE 
  key_id = '77799921b6ec18f954df935c12d75b14726a61348befd66fbf2e11ed906b6de2' 
  AND (
    token = 'MMHdo0LEPu3YjnKCqmzzjsF/oHsKtkeJQ7YlHu/ZkdU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040