UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a9zT3CFuR17dQHpUrHJuT82HJJuNPFIAmSy7wTVAZbU=' 
WHERE 
  key_id = '3eccfe1d65d9a9fa5d679652afc363cc6e3f6d3d5d9a89371a257db093393dd3' 
  AND (
    token = 'a9zT3CFuR17dQHpUrHJuT82HJJuNPFIAmSy7wTVAZbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032