UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JZTgoRgOLabfTugl+KNd82nODMjW/uSNsP4UzPo2Eco=' 
WHERE 
  key_id = 'd8ce566fbf7e0ee7d167794e593760b6d02f3a7d4d7dbe20b1b146e988103c8d' 
  AND (
    token = 'JZTgoRgOLabfTugl+KNd82nODMjW/uSNsP4UzPo2Eco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052