UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd5O9tfGcrscAyooZNnbXSHzVaF++epcE5JVZbOtHf3I='
WHERE
key_id = 'ab58a13a303c76d19fbf68527dbb949cadf5ac9eeb9ff7a9f6bb5b3d7585cfd1'
AND (
token = 'd5O9tfGcrscAyooZNnbXSHzVaF++epcE5JVZbOtHf3I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)