UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HfvEK3p6AJk7XFfJMLpFXE5jbrvJFXtsK4BYWm61Hms='
WHERE
key_id = 'dec18ec324df0248a81b076279addebc937e64b6f7af93ffb6817dd9e11c34d9'
AND (
token = 'HfvEK3p6AJk7XFfJMLpFXE5jbrvJFXtsK4BYWm61Hms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)