UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd9HjczRVSiuKgkx0SiBJ8oqTcXTD+j0H+1Fbiu+AUYI='
WHERE
key_id = '8a03e58243ceeda1b30d5ba7cf25804a0439b44b7f29bb88d16f3ec0ec6f49f4'
AND (
token = 'd9HjczRVSiuKgkx0SiBJ8oqTcXTD+j0H+1Fbiu+AUYI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)