UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OKbwDXzqfizVtsPi89+GXecef/slfe81bzoPC80X/os='
WHERE
key_id = 'f49f06209e0e31166510206875d42427accffd039b7d26266ec4d904fdcfdbdc'
AND (
token = 'OKbwDXzqfizVtsPi89+GXecef/slfe81bzoPC80X/os='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)