UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mwQ612esHAw+202S2PTygc3ueKY9jPLI/v75rntIUJs='
WHERE
key_id = 'd5c1214d5881a7407a402b6216fb4b0e8ed580ccdf8641445e988f64582c602f'
AND (
token = 'mwQ612esHAw+202S2PTygc3ueKY9jPLI/v75rntIUJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)