UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S6gtQ9tNb7lvXsQ+YbtZTuQSB54TNZYR0mLuOXqv6VA='
WHERE
key_id = '1d402a0c323ce225ae3fd6913a23ae36a99b93b96451092c3be7aac0cc92f661'
AND (
token = 'S6gtQ9tNb7lvXsQ+YbtZTuQSB54TNZYR0mLuOXqv6VA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)