UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E71rdi+ax7XlucaSyrzjqxOhIz6PkAUr6KltR43a5ss=' 
WHERE 
  key_id = '8be30f73d500cc59df23d0e5c4ed64e2bfb8b9704c1e2ee44ac76089f6f2cfec' 
  AND (
    token = 'E71rdi+ax7XlucaSyrzjqxOhIz6PkAUr6KltR43a5ss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025