UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WoYERZzD2DyV2G5stMbwZzb0cUsAdMEAy3WyET5hKcw='
WHERE
key_id = '5130940a8d9bb7e303073fd1b5ccfbf218f405a313e11ee56194203fcb3a9b88'
AND (
token = 'WoYERZzD2DyV2G5stMbwZzb0cUsAdMEAy3WyET5hKcw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)