UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YdS79n0wh6CasErFP7oE70cu5yhzL2Ch8TjcsHFWEX8='
WHERE
key_id = '7d2d36b9794f934b0b0f26eec5f482b4eda613b5fd6be5753cc0fdac8af866d3'
AND (
token = 'YdS79n0wh6CasErFP7oE70cu5yhzL2Ch8TjcsHFWEX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)