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