UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'riY6sk4u8Qhf86WbdU28ve71O68zQgKuHJM659JDwV4='
WHERE
key_id = 'ed3817db4455aaf48f26e76a3ee38728930f0fd6e372bac80529f261e7d9cc8a'
AND (
token = 'riY6sk4u8Qhf86WbdU28ve71O68zQgKuHJM659JDwV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)