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