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