UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xInY0ryEnW23OHiVFFvd/7yqpl6gpGU7n3dODEWvMlI='
WHERE
key_id = '6732bb0613c0a6d3e14b820a3b81a18de2b10f3fa257ea3fb43352b8617891dc'
AND (
token = 'xInY0ryEnW23OHiVFFvd/7yqpl6gpGU7n3dODEWvMlI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)