UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VjdbquN3MWgHpfGy0csUESRa/0Z1MYEsFtQ/uliPr9U=' 
WHERE 
  key_id = '3481d215818a9529afc304d6bd13e10851c013a9e9436e52b4b6cd946e3baf5a' 
  AND (
    token = 'VjdbquN3MWgHpfGy0csUESRa/0Z1MYEsFtQ/uliPr9U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038