UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YGjGsiTL2Shr+lqrxuBUQvK+qC84HLaGkEbGTsdLDys='
WHERE
key_id = 'ad0edd8547e46ebb751d0e1a68b41a1c68a70aa92979a321af4d74b9a4b6daca'
AND (
token = 'YGjGsiTL2Shr+lqrxuBUQvK+qC84HLaGkEbGTsdLDys='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)