UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2caKeyUO5hV8FxyhOqH46eaUq732L0zly/EtgGXmY+o=' 
WHERE 
  key_id = '866d204031943be403b87b1a71f0ccf3a99d98dce24c10e4581e1d4d0e98037a' 
  AND (
    token = '2caKeyUO5hV8FxyhOqH46eaUq732L0zly/EtgGXmY+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042