UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QWL1VTru7z/RDU1sjBmlPcKX/uiAmwBJCwa4+wcdqZk='
WHERE
key_id = 'be2b360f61b9ed17f28c783a849ab409f6f108b8ac9fd8801b0d8066b20a1805'
AND (
token = 'QWL1VTru7z/RDU1sjBmlPcKX/uiAmwBJCwa4+wcdqZk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)