UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TD5EGTRaqqsOk2dbD8oJgG6bEAKJ5HToUZXU7+5OWcc='
WHERE
key_id = '5b312eca472d30c06116c1af178b1adb1ab46a5770f360e0462c80bf5211d389'
AND (
token = 'TD5EGTRaqqsOk2dbD8oJgG6bEAKJ5HToUZXU7+5OWcc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)