UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mCXfg2bbL4YVtWJidar10josTs6f61ccaMkhu4jbn7k=' 
WHERE 
  key_id = '333aa964f4f640f9556ff9d243dfb0215e30c6976e04513cce516237f1dadf66' 
  AND (
    token = 'mCXfg2bbL4YVtWJidar10josTs6f61ccaMkhu4jbn7k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00110