UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Aajr0N9i6DTwnLx+InoJiz3qxV5e4GCAIB7uL5qJasg='
WHERE
key_id = '5b97ead5842c7050be57e8a7d01934b289322a0b447366b67e8e04eb707963d0'
AND (
token = 'Aajr0N9i6DTwnLx+InoJiz3qxV5e4GCAIB7uL5qJasg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)