UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0xaf7UQDFT0xGH+GeXXzJWucbmhmcuKkoCMKM3E1STM='
WHERE
key_id = 'b287eadf86f41500bbfe45d948209447e63e6b525e28cd3317887f7532856969'
AND (
token = '0xaf7UQDFT0xGH+GeXXzJWucbmhmcuKkoCMKM3E1STM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)