UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DYcdOus8m1DTwJBDCTIANTr/xcLOb6fLQv/BXRz3DP8='
WHERE
key_id = '018770c17623dc6367daf5b93cc9282d320ab409765bdfa906df29f6e9e1920e'
AND (
token = 'DYcdOus8m1DTwJBDCTIANTr/xcLOb6fLQv/BXRz3DP8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)