UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O7tNAEyrSC+n8wHral/PMXH0m3BqTvRXlF1ncm6NiA8=' 
WHERE 
  key_id = '8944ef64ba2ac2cf20b5b49a1f3eeb3804dd45fb76637e05a7386ed28191f33d' 
  AND (
    token = 'O7tNAEyrSC+n8wHral/PMXH0m3BqTvRXlF1ncm6NiA8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031