UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sw4QOZ99XmDWiIiNJjkfDtiVqPZbf/0/3spfBf/70zo='
WHERE
key_id = '7d3fcb8959736f31639438341e34266383e274eeea333383bec659a762ad0b24'
AND (
token = 'sw4QOZ99XmDWiIiNJjkfDtiVqPZbf/0/3spfBf/70zo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)