UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Jz4BMTh4rpTiu2b9Z5dWIsQxY/TZW7bNE1OTtNDSH60='
WHERE
key_id = 'd10c8142824a1f52703b10b59bad72ee72da80227352e35fc791bcb04f4174b0'
AND (
token = 'Jz4BMTh4rpTiu2b9Z5dWIsQxY/TZW7bNE1OTtNDSH60='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)