UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sdgKKLm/L8iRbQEZ+Njm871hT/zlZcBIfW0sEOU91+k='
WHERE
key_id = '25af7f65b23ef9d50a57d20a4dcbbcf5620f340eeab7971be0a5087fa9464cb1'
AND (
token = 'sdgKKLm/L8iRbQEZ+Njm871hT/zlZcBIfW0sEOU91+k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)