UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6N6Sy7WLL/v3gE8fBJn+ctlnh0IclFmybghZ4UZFGn8='
WHERE
key_id = '10e7791460f45044ec6e1b09fbd8e80b6679b80db4ccea39fdb8b2a5ad225ee5'
AND (
token = '6N6Sy7WLL/v3gE8fBJn+ctlnh0IclFmybghZ4UZFGn8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)