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