UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KJLKqYupEOUWvR3Oa4VIF/PRG2z4jAaCHaqZ+q3cnhA='
WHERE
key_id = '387b27a3ce831c6b53e5f621bb416682de902010721671c580d24e7652adda3b'
AND (
token = 'KJLKqYupEOUWvR3Oa4VIF/PRG2z4jAaCHaqZ+q3cnhA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)