UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x4xZtXTwbzoxqSwdRse/tMm8BFrHyfxWpwFHlSlpG7I='
WHERE
key_id = '047df5cd2b49e358cf14a9c3a7a616c455d436e4c7c8fe867481054a8a4b1853'
AND (
token = 'x4xZtXTwbzoxqSwdRse/tMm8BFrHyfxWpwFHlSlpG7I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)